<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>班级薪资分布</title>
    <script src="./echarts.min.js"></script>
  </head>
  <body>
    <div id="main" style="width: 600px; height: 400px"></div>
    <script>
      var myChart = echarts.init(document.getElementById("main"))
      const data = [
        {
          name: "Apples",
          value: 70,
        },
        {
          name: "Strawberries",
          value: 68,
        },
        {
          name: "Bananas",
          value: 48,
        },
        {
          name: "Oranges",
          value: 40,
        },
      ]
      const option = {
        title: [
          {
            text: "男女薪资分布",
            left: "20%",
          },
          {
            subtext: "男生",
            left: "center",
            top: "40%",
          },
          {
            subtext: "女生",
            left: "center",
            top: "80%",
          },
        ],
        series: [
          {
            type: "pie",
            radius: ["20%", "30%"],
            center: ["50%", "20%"],
            data: data,
            label: {
              position: "outer",
              alignTo: "none",
              bleedMargin: 5,
            },
            left: "center",
            top: "5%",
          },
          {
            type: "pie",
            radius: ["20%", "30%"],
            center: ["50%", "70%"],
            data: data,
            label: {
              position: "outer",
              alignTo: "labelLine",
              bleedMargin: 5,
            },
            left: "center",
            bottom: "5%",
          },
        ],
        color: ["#34d39a", "#fda224", "#5097ff", "#3fceff"],
      }
      myChart.setOption(option)
    </script>
  </body>
</html>
